namespace Examples.UnitTestATM
{
    public class AutomatedTellerMachine
    {
        private readonly IAccountRepository _accountRepository;

        public AutomatedTellerMachine(IAccountRepository accountRepository)
        {
            _accountRepository = accountRepository;
        }

        public WithdrawStatus Withdraw(string accountNumber, Money amount)
        {
            var account = _accountRepository.Find(accountNumber);
            if (account == null)
            {
                return new WithdrawStatus("Cannot find your account", new Money(0));
            }
            return account.Withdraw(amount);
        }
    }
}